package com.gofull.gateway.wechat.config;

import com.shove.io.file.PropertyFile;

public class WechatConfig {
	
	public static String TOKEN = "gofullwchat";
	public static String APPID = "wx416157941b302d3c";
	//public static String APPSECRET = "c311064bd4d9f483ce15f231f4f5009f";
	
	public static String APPSECRET = "8b99eedf4478373bee34c52f5afc538c";
	
	public static String WZAPPID = "adfasag";
	public static String WZAPPSECRET = "sfasfdasd";
	public static String GET_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential";
	public static String JSAPI_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?type=jsapi";
	
	public static String OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code";
	public static String OAUTH2_ACCESS_TOKEN_REFRESH_URL = "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN";
	public static String GET_SNSAPI_USERINFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
	public static String CHECKOUT_OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/auth?access_token=ACCESS_TOKEN&openid=OPENID";
	
	public static String WZ_CODE_URL =  "https://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=http%3a%2f%2fwww.gofull.com.cn%2fwechatLoginCallback.do&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect";
	
	public static String TEMPLATE_URL =  "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN";
	public static String USER_INFO_URL = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN";
	
	public static String SEMANTIC_URL = "https://api.weixin.qq.com/semantic/semproxy/search?access_token=ACCESS_TOKEN";
	
	static {
		PropertyFile pf = new PropertyFile();
		TOKEN = pf.read("token");
		APPID = pf.read("AppID");
		APPSECRET = pf.read("AppSecret");
		WZAPPID = pf.read("wzAppID");
		WZAPPSECRET = pf.read("wzAppSecret");
		GET_ACCESS_TOKEN_URL = pf.read("token_url") + "&appid=" + APPID + "&secret=" + APPSECRET;
		JSAPI_TICKET_URL = pf.read("jsapi_ticket_url");
		
		OAUTH2_ACCESS_TOKEN_URL = pf.read("oauth2_access_token_url");
		OAUTH2_ACCESS_TOKEN_REFRESH_URL = pf.read("oauth2_access_token_refresh_url");
		GET_SNSAPI_USERINFO_URL = pf.read("get_snsapi_userinfo_url");
		CHECKOUT_OAUTH2_ACCESS_TOKEN_URL = pf.read("checkout_oauth2_access_token_url");
		WZ_CODE_URL = pf.read("wz_code_url").replace("APPID", WZAPPID);
		TEMPLATE_URL = pf.read("template_url");
		USER_INFO_URL = pf.read("user_info_url");
		SEMANTIC_URL = pf.read("semantic_url");
	}

}
